<template>
    <div class="index">
        <el-container>
            <!-- 顶部 -->
            <div class="header f-cen">
                <div class="header-box f-bet">
                    <div class="search">
                        <el-input
                            placeholder="Search..."
                            input-style="height:20px;border:none;width: 100px;
                    font-size: 10px;"
                            :suffix-icon="Search"
                        />
                    </div>
                    <div class="login f-aro c">
                        <div class="login-box">f</div>
                        <div class="login-box">f</div>
                        <div class="login-box">in</div>
                    </div>
                </div>
            </div>
            <div class="header-deliver"></div>
            <!-- 网页信息 -->
            <div class="header-info f-cen">
                <div class="header-info-box f-bet">
                    <img src="../assets/images/home/logosololettering.png" />
                    <div class="text-box f-aro">
                        <div class="info f">
                            <div class="icon f-cen">
                                <el-icon>
                                    <message />
                                </el-icon>
                            </div>
                            <div class="text">ingegneria@biot.it</div>
                        </div>
                        <div class="info f">
                            <div class="icon f-cen">
                                <el-icon>
                                    <phone />
                                </el-icon>
                            </div>
                            <div class="text">+39.327.85.66.369</div>
                        </div>
                        <div class="line-button f-cen f-col" v-show="screenFlag">
                            <div class="line"></div>
                            <div class="line"></div>
                            <div class="line"></div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 导航菜单 -->
            <div class="header-deliver" id="deliver"></div>
            <!-- 防止导航栏高度塌陷的占位盒子 -->
            <div v-show="isFixed" style="height:60px"></div>
            <!-- 导航栏 -->
            <el-header class="menu f-cen" :class="{ 'fixed': isFixed }" v-if="!screenFlag">
                <el-menu
                    class="menu-title"
                    :default-active="activeIndex"
                    :router="true"
                    mode="horizontal"
                    :ellipsis="false"
                >
                    <el-menu-item index="/home">HOME</el-menu-item>
                    <el-menu-item index="/tecnoogie">TECNOOGIE</el-menu-item>
                    <el-menu-item index="/formazione">FORMAZIONE</el-menu-item>
                    <el-menu-item index="/ricerca">RICERCA E SVILUPPO</el-menu-item>
                    <el-menu-item index="/distributors">DISTRIBUTORS</el-menu-item>
                    <el-menu-item index="/news">NEWS</el-menu-item>
                    <el-menu-item index="/careers">CAREERS</el-menu-item>
                    <el-menu-item index="/contatti">CONTATTI</el-menu-item>
                </el-menu>
            </el-header>

            <!-- main -->
            <router-view></router-view>
            <!-- 返回顶部 -->
            <el-backtop :bottom="10" :right="10">
                <div
                    style="height: 100%; width: 100%; box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);text-align: center; line-height: 40px; color: #fff;"
                >UP</div>
            </el-backtop>
            <!-- 底部邮箱 -->
            <div class="email f-cen">
                <div class="email-box">
                    <div class="email-box-main">
                        <div class="email-title">Iscriviti alla newsletter</div>
                        <div class="f-bet">
                            <div class="input-email">
                                <input type="text" placeholder="Email*" class="input" />
                            </div>
                            <div class="input-name">
                                <input type="text" placeholder="Name*" class="input" />
                            </div>
                        </div>

                        <div
                            class="email-text"
                        >Dichiaro di aver preso visione dell'Informativa Privacy in ottemperanza al GDPR/2018</div>
                        <div class="email-item">
                            <input type="checkbox" />Si, voglio ricevere le vostre newsletter periodiche
                        </div>
                        <button class="email-btn">ISCRIVITI</button>
                    </div>
                    <div class="block"></div>
                </div>
            </div>
            <!-- 友情链接 -->
            <div class="links f-cen">
                <div class="links-box f-bet">
                    <div class="webInfo f-col">
                        <img
                            src="../assets/logo-footer.png"
                            style="width:120px;margin-bottom: 5px;"
                        />
                        Bio-T S.r.l. Technologies for life
                        <br />Via A. Baldovinetti, 81
                        <br />00142 Roma
                        <div class="iconList">
                            <img src="../assets/whatsapp-footer.png" />
                            <img src="../assets/facebook-footer.png" />
                            <img src="../assets/linkedin-footer.png" />
                            <img src="../assets/youtube-footer.png" />
                        </div>
                        <a href="#">Privacy policy e note legali</a>
                    </div>
                    <div class="cantatti">
                        <div class="links-title">Contatti</div>
                        <p>Tel. +39 06.83086609</p>
                        <p>Fax. +39 06 83391913</p>
                        <p>Mob. +39 3278566369</p>
                        <p>email: info@biot.it - ingegneria@biot.it</p>
                    </div>
                    <div class="bio-t">
                        <div class="links-title">Bio-T</div>
                        <a href="#">Tecnologie</a>
                        <a href="#">Formazione</a>
                        <a href="#">Distributori</a>
                        <a href="#">News</a>
                        <a href="#">Ricerca e sviluppo</a>
                        <a href="#">Contatti</a>
                    </div>
                    <div class="show">
                        <div class="links-title">I siti del gruppo</div>
                        <div class="imgList f">
                            <div class="imgList-item">
                                <img src="../assets/ciem.jpg" alt />
                                <a href="#">ciemsystem.com</a>
                            </div>
                            <div class="imgList-item">
                                <img src="../assets/enerpulse.jpg" alt />
                                <a href="#">enerpulse.it</a>
                            </div>
                            <div class="imgList-item">
                                <img src="../assets/medcam-sito.jpg" alt />
                                <a href="#">medcam.it</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- footer -->
            <el-footer>
                Bio-t S.r.l. Tecnologie per la Vita CF/P.IVA 10435191001 - Iscrizione R.E.A. 1231512 Capitale Sociale 50.000 € i.v. - All rights Reserved © 2022
                <br />L'accesso alla visualizzazione dei prodotti e al materiale informativo è riservato agli operatori del settore in ottemperanza alla legislazione vigente.Ex D. lgs 46/1997. Pertanto Bio-t S.r.l. autorizza i soli professionisti a procedere con la navigazione.
            </el-footer>
        </el-container>
    </div>
</template>

<script setup>
import { Search } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router'
import { onMounted, ref, toRaw } from 'vue';
//滚动的导航栏，判断滚动高度
let isFixed = ref(false)
const handleScroll = () => {
    let scrollY = window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop
    let scrollObj = document.querySelector('#deliver').offsetTop
    if (scrollY >= scrollObj) {
        isFixed.value = true
    } else {
        isFixed.value = false
    }
}
onMounted(() => {
    //监听滚动
    window.addEventListener('scroll', handleScroll)
    // 监听窗口变化
    window.addEventListener("resize", function () {
        return (() => {
            window.screenWidth = document.body.clientWidth;
            screenWidth = window.screenWidth;
            if (screenWidth < 1000) {
                screenFlag.value = true
            } else {
                screenFlag.value = false
            }
        })();
    });
})

//激活的导航栏
const route = useRoute()
let activeIndex = ref(toRaw(route).fullPath.value)

//屏幕宽度
let screenWidth = document.body.clientWidth
let screenFlag = ref(false)
if (screenWidth <= 1000) {
    screenFlag.value = true
}

</script>

<style scoped lang="less">
.fixed {
    position: fixed;
    max-width: 100% !important;
    z-index: 99999;
}
.index {
    .header {
        width: 100%;
        padding: 8px 50px;
        align-self: center;
        .header-box {
            width: @box-width;
            .search {
                &:deep(.el-input__inner, input::-webkit-input-placeholder) {
                    border: none;
                    box-shadow: none;
                }
                &:deep(input::-webkit-input-placeholder) {
                    color: @text-bg;
                }
                &:deep(.el-input__icon) {
                    color: @text-bg;
                    transform: rotateY(180deg);
                    font-size: 12px;
                }
            }
            .login {
                width: 72px;
                height: 20px;
                .login-box {
                    width: 20px;
                    height: 20px;
                    color: @text;
                    background-color: @text-bg;
                    line-height: 20px;
                    font-weight: 600;
                    font-size: 10px;
                    cursor: pointer;
                    transition: all 0.5s;
                    &:hover {
                        background-color: @bg3;
                    }
                }
            }
        }
    }
    .header-deliver {
        width: 100%;
        border: 1px solid #efefef;
    }
    .header-info {
        width: 100%;
        padding: 25px 50px;

        .header-info-box {
            max-width: @box-width;
            width: 100%;
            color: @text-title;
            img {
                height: 100px;
                width: 150px;
            }
            .text-box {
                font-size: 20px;
                .info {
                    margin: 10px;
                    .icon {
                        width: 16px;
                        margin-right: 8px;
                        font-size: 24px;
                        color: @text-bg;
                    }
                }
            }
            .line-button {
                width: 40px;
                height: 40px;
                cursor: pointer;
                .line{
                    height: 2px;
                    width: 60%;
                    background-color: @bg1;
                    margin: 3px;
                    transition: .5s;
                }

            }
        }
    }
    .menu {
        width: 100%;
        background-color: #ffffff;
        padding: 0 50px;
        transition: all 0.3s ease;
        border-bottom: 1px solid #efefef;
        overflow: hidden;
        .menu-title {
            font-weight: 600;
            border-top: none;
            border-bottom: none;
            max-width: @box-width;
            width: 100%;

            .is-active {
                border-top: 3px solid @text-bg !important;
                border-bottom: none;
                color: @text-bg !important;
            }
            .el-menu-item {
                border-left: 1px solid #efefef;
                background-color: #ffffff;
                width: 100%;
                height: 60px;
                border-bottom: none;
                transition: all 0.1s;
                color: @text-title;
                padding: 0 15px;
                &:last-child {
                    border-right: 1px solid #efefef;
                }
                &:hover {
                    border-top: 3px solid @text-bg !important;
                    color: @text-bg;
                }
            }
        }
    }
    .el-backtop {
        border-radius: 0 !important;
        div {
            background-color: rgb(223, 223, 223);
            transition: all 0.5s;

            &:hover {
                background-color: rgb(109, 109, 109);
            }
        }
    }
    .email {
        background-position: center;
        background-image: url("../assets/emailbg.jpg");
        padding: 50px 100px;

        &-box {
            width: @box-width;
            .block {
                width: 50%;
            }
            &-main {
                width: 50%;
                .email-title {
                    color: @text-title;
                    font-weight: 600;
                    font-size: 34px;
                    margin: 20px 0;
                    text-align: center;
                }

                .input {
                    border: none;
                    border-radius: 0;
                    padding: 10px 15px;
                    width: 100%;
                    &:focus {
                        outline: none;
                    }
                }
                .input-email {
                    flex: 1;
                    margin-right: 25px;
                }
                .input-name {
                    flex: 1;
                }

                .email-text,
                .email-item {
                    font-size: 12px;
                    color: #686868;
                    margin-top: 15px;
                }
                .email-item {
                    margin-bottom: 20px;
                    input {
                        margin-right: 5px;
                    }
                }
                .email-btn {
                    border: none;
                    color: #ffffff;
                    padding: 12px 22px;
                    background-color: #224980;
                    font-weight: 200;
                    cursor: pointer;
                }
            }
        }
    }
    .links {
        background-color: @text-bg;
        padding: 40px 20px;
        line-height: 25px;

        &-box {
            width: @box-width;
            color: @text;
            font-size: 14px;
            .links-title {
                font-size: 24px;
                color: @text-title;
                font-weight: 600;
                margin-bottom: 15px;
            }
            .webInfo {
                line-height: 16px;
                .iconList {
                    img {
                        margin: 15px 10px 15px 0;
                    }
                }
            }

            a {
                display: block;
                color: @text;
                &:hover {
                    text-decoration: underline;
                }
            }

            .show {
                .imgList {
                    &-item {
                        margin-right: 8px;
                        img {
                            max-width: 120px;
                        }
                    }
                }
            }
        }
    }
    .el-footer {
        text-align: center;
        padding: 10px 20px;
        height: 100%;
        font-size: 12px;
        color: @text;
        background-color: @bg1;
    }
}
</style>
